import HomeView from '@/views/HomeView.vue'
import accessEnum from '@/access/accessEnum'
import {
  BookOutlined,
  FileTextOutlined,
  FolderOutlined,
  HomeOutlined,
  QuestionCircleOutlined,
  SettingOutlined,
} from '@ant-design/icons-vue'
import { h } from 'vue'

export const routes = [
  {
    path: '/',
    name: 'home',
    label: '首页',
    icon: () => h(HomeOutlined),
    component: HomeView,
  },
  {
    path: '/admin',
    name: 'admin',
    label: '管理页',
    icon: () => h(SettingOutlined),
    redirect: '/admin/user',
    children: [
      {
        path: '/admin/user',
        name: 'userManage',
        label: '用户管理',
        component: () => import('@/views/admin/UserManage.vue'),
      },
      {
        path: '/admin/app',
        name: 'appManage',
        label: '应用管理',
        component: () => import('@/views/admin/AppManage.vue'),
      },
      {
        path: '/admin/chat',
        name: 'chatManage',
        label: '对话管理',
        component: () => import('@/views/admin/ChatManage.vue'),
      },

    ],
    meta: {
      access: accessEnum.ADMIN,
    },
  },
  {
    path: '/app/chat/:id',
    name: 'appChat',
    label: '应用生成对话',
    component: () => import('@/views/app/AppChatView.vue'),
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: '/app/edit/:id',
    name: 'appEdit',
    label: '编辑应用',
    component: () => import('@/views/app/AppEditView.vue'),
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: '/projects',
    name: 'projects',
    label: '我的项目',
    icon: () => h(FolderOutlined),
    component: () => import('@/views/ProjectsView.vue'),
  },
  {
    path: '/templates',
    name: 'templates',
    label: '模板中心',
    icon: () => h(FileTextOutlined),
    component: () => import('@/views/TemplatesView.vue'),
  },
  {
    path: '/docs',
    name: 'docs',
    label: '使用文档',
    icon: () => h(BookOutlined),
    component: () => import('@/views/DocsView.vue'),
  },
  {
    path: '/about',
    name: 'about',
    label: '关于',
    icon: () => h(QuestionCircleOutlined),
    component: () => import('@/views/AboutView.vue'),
  },
  {
    path: '/user/login',
    name: 'login',
    component: () => import('@/views/user/Login.vue'),
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: '/user/register',
    name: 'register',
    component: () => import('@/views/user/Register.vue'),
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: '/user/info',
    name: 'userInfo',
    component: () => import('@/views/user/userInfo.vue'),
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: '/noAuth',
    name: 'noAuth',
    component: () => import('@/views/noAuth.vue'),
    meta: {
      hideInMenu: true,
    },
  },
]
